<?php session_start(); ?>
<?
// VARIABLES A COMPLETAR
$var_template = 'emailer-planilla.txt';
$var_destinatario = 'info@oncargoinc.com';
$var_envia = 'customer@oncargoinc.com';
$var_titulo = 'Solicitud de Cotizacion';
$var_gracias = 'SV-detalle-articulo.php?id=9';

$fp = fopen($var_template, 'r');
$template = fread($fp, filesize($var_template));
fclose($fp);

while(list($key, $val) = each($_POST)) {
	$key_x = ':'.$key.':';
	$template = ereg_replace($key_x,$val,$template);
}

$template.= 'IP: '.$_SERVER['REMOTE_ADDR'];

include_once $_SERVER['DOCUMENT_ROOT'] . '/securimage/securimage.php';

$securimage = new Securimage();

if ($securimage->check($_POST['captcha_code']) == false) {
  // the code was incorrect
  // handle the error accordingly with your other error checking

  // or you can do something really basic like this
  die('The code you entered was incorrect.  Go back and try again.');
}

@mail($var_destinatario, $var_titulo, $template, "From: $var_envia\r\nReply-to:$var_envia");
header('Location: '.$var_gracias);
?>